// @Description: 注册提供系统system相关的路由
package routers

import (
    "github.com/astaxie/beego"
    "cloud_worm/wormweb/controllers/ctrconfig"
    "cloud_worm/wormweb/controllers/ctrsystem"
    "cloud_worm/wormweb/controllers/ctrservice"
    "cloud_worm/wormweb/controllers/ctrsystem/worm"
)

func init()  {
    /**********************
      系统运营相关
    */
    // cmd命令执行，有token校验
    beego.Router("/agent/cmd", &ctrservice.DoCmdController{}, "post:Post")


    beego.Router("/agent/update", &ctrservice.AgentUpdateController{}, "post:Update")
    beego.Router("/agent/real/online", &ctrservice.AgentRealOnline{}, "get:Get")

    /**********************
     系统任务相关
    */
    // 任务完成之后，执行alert分析的处理， todo：token校验，待进一步实现
    //beego.Router("/task/alert/deal", &analyzer.DoTaskAlertDeal{}, "post:DoTaskAlert")

    /**********************
      user管理
    */
    //beego.Router("/user/register", &ctrconfig.UserController{}, "post:Register")            // todo: 待实现，后续在增加company概念时提供
    beego.Router("/user/login", &ctrconfig.LoginCtr{}, "post:LoginByPassWord")
    beego.Router("/user/logout", &ctrconfig.UserController{}, "post:Logout")
    beego.Router("/user/get", &ctrconfig.UserController{}, "get:Get")
    beego.Router("/user/change/info", &ctrconfig.UserController{}, "post:ChangeInfo")
    beego.Router("/user/change/password", &ctrconfig.UserController{}, "post:ChangePassword")

    beego.Router("/admin/user/all", &ctrconfig.AdminController{}, "get:All")
    beego.Router("/admin/user/set", &ctrconfig.AdminController{}, "post:Set")
    beego.Router("/admin/user/add", &ctrconfig.AdminController{}, "post:Add")

    /**********************
      web中token管理
    */
    beego.Router("/token/list", &ctrconfig.TokenController{}, "get:Get")
    beego.Router("/token/create", &ctrconfig.TokenController{}, "post:Create")
    beego.Router("/token/edit", &ctrconfig.TokenController{}, "post:Edit")

    /**********************
 	 worm cloud 管理
	*/
    /* 软件包管理 */
    beego.Router("/package/upload", &worm.PackageController{}, "post:Upload")
    beego.Router("/package/list", &worm.PackageController{}, "get:PackList")
    beego.Router("/package/update", &worm.PackageController{}, "post:UpdateStatus")

    // 回复路由管理grayrouter
    beego.Router("/gray/router/get", &worm.GrayRouterController{}, "get:Get")
    beego.Router("/gray/router/set", &worm.GrayRouterController{}, "post:Post")

    /* router路由配置相关的 */
    // 展示route config
    beego.Router("/route/list", &worm.RouteConfController{}, "get:Get")
    beego.Router("/route/insert", &worm.RouteConfController{}, "post:Insert")
    beego.Router("/route/update", &worm.RouteConfController{}, "post:Update")
    /* access server 相关 */
    beego.Router("/access/list", &worm.AccessSrvController{}, "get:Get")
    beego.Router("/access/update", &worm.AccessSrvController{}, "post:UpdateStatus")
    beego.Router("/access/select", &worm.AccessSrvController{}, "get:Select")
    beego.Router("/access/info", &worm.AccessSrvInfoController{}, "get:Get")

    /**********************
     开关配置处理
    */
    beego.Router("/config/list", &ctrsystem.ConfigController{}, "get:List")
    beego.Router("/config/edit", &ctrsystem.ConfigController{}, "post:Edit")
}
